{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Renormalizing S-parameters " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This example demonstrates how to use skrf to renormalize a Network's s-parameters to new port impedances. Although trivial, this example creates a matched load in 50ohms and then re-normalizes to a 25ohm environment, producing a reflection coefficient of 1/3." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ok lets do it" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import skrf as rf\n", "from skrf.instances import wr10\n", "\n", "%matplotlib inline\n", "\n", "rf.stylely()\n", "\n", "# this is just for plotting junk\n", "kw = dict(draw_labels=True, marker = 'o', markersize = 10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a one-port ideal match Network, (using the premade media class wr10 as a dummy)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "match_at_50 = wr10.match()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that the z0 for this Network defaults to a constant 50ohm" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "match_at_50" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plotting its reflection coefficient on the smith chart, shows its a match" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "match_at_50.plot_s_smith(**kw)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, renormalize the port impedance from 50 -> 25, thus the previous 50ohm load now produces a reflection coefficient of \n", "\n", "\n", "$$ \\Gamma^{'} = \\frac{50-25}{50+25} = \\frac{25}{75} = .333 $$\n", "\n", "\n", "Plotting the renormalized response on the Smith Chart" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "match_at_50.renormalize(25)\n", "match_at_50.plot_s_smith(**kw)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Complex Impedances " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You could also renormalize to a complex port impedance if you're crazy. For example, renormalizing to 50j, one would expect:\n", "$$\n", "\\Gamma^{'} = \\frac{50-50j}{50+50j} = 50\\frac{1-j}{1+j} = -50j\n", "$$\n", "\n", "However, one finds an unexpected result when plotting the Smith chart:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "match_at_50 = wr10.match()\n", "match_at_50.renormalize(50j) # same as renormalize(50j, s_def='power')\n", "match_at_50.plot_s_smith(**kw) # expect -1j" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is because the default behaviour of scikit-rf is to use _power-waves_ scattering parameter definition (since it is the most popular one is CAD software). But the _power-waves_ definition is [known to fail in such a case](https://www.nist.gov/system/files/documents/2017/05/09/MicrowaveCircuitTheory-proof.pdf). This is why scikit-rf also implement the _pseudo-waves_ scattering parameters definition, but you have to specify it using the `s_def` parameter: " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "match_at_50 = wr10.match()\n", "match_at_50.renormalize(50j, s_def='pseudo')\n", "match_at_50.plot_s_smith(**kw) # expect -1j" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Which gives the expected result. " ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 1 }